class Solution:
    def searchInsert(self, nums: List[int], target: int) -> int:
        l=0
        r=len(nums)-1
        while l<=r:
            a=int(l+(r-l)//2)
            if nums[a]==target:
                return a
            elif nums[a]>target:
                r=a-1
            else:
                l=a+1
        return l
